<!--  -->
<template>
  <div id="member" v-show="boxShow">
    <div class="memberBox">
      <!-- <span class="close" @click="close">
          <i class="icon sp-x_nor"></i>
        </span> -->
      <login ref="myLogin" :show.sync="type" @toggleType="toggleType"></login>
      <register
        ref="myRegister"
        :show.sync="type"
        @toggleType="toggleType"
      ></register>
      <forget
        ref="myForget"
        :show.sync="type"
        @toggleType="toggleType"
      ></forget>
      <!-- 修改密码 -->
      <changePassword
        ref="changePassword"
        :show.sync="type"
        @toggleType="toggleType"
      ></changePassword>
    </div>
  </div>
</template>

<script>
const login = () => import("./login");
const register = () => import("./register");
const forget = () => import("./forget");
const changePassword = () => import("../comps/changePassword");
import { CLIENT } from "@/common/const";
export default {
  data() {
    return {
      boxShow: false,
      type: 1, //默认注册
      path: CLIENT,
      urlParams: this.$fn.getUrlParams(),
    };
  },
  components: {
    login: login,
    register: register,
    forget: forget,
    changePassword: changePassword,
  },
  mounted() {
    this.boxShow = true;
    this.type = Number(this.urlParams.type);
  },
  methods: {
    close() {
      this.boxShow = false;
      this.$refs.myLogin.initialize();
      this.$refs.myRegister.initialize();
      this.$refs.myForget.initialize();
    },
    toggleType(num) {
      this.type = num;
    },
  },
};
</script>
<style>
html,
body {
  height: 100%;
}
* {
  margin: 0;
  padding: 0;
}
</style>
<style lang="scss" scoped>
#member {
  height: 100%;
  position: relative;
  .memberBox {
    width: 319px;
    height: 366px;
    background: #fff;
    position: absolute;
    overflow: hidden;
    top: 50%;
    margin-top: -183px;
    left: 50%;
    margin-left: -159.5px;
    .close {
      position: absolute;
      display: inline-block;
      width: 34px;
      height: 34px;
      line-height: 34px;
      right: 0;
      top: 0;
      text-align: center;
      cursor: pointer;
      &:hover {
        background: #ea2827;
        .icon {
          background-position: -144px -94px;
        }
      }
      &:active {
        background: #c11c1b;
      }
      &:after {
        content: "";
        display: inline-block;
        width: 0;
        height: 100%;
        vertical-align: middle;
      }
      .icon {
        display: inline-block;
        vertical-align: middle;
      }
    }
  }
}
</style>
